package demo03;

import java.util.function.BiPredicate;
import java.util.function.Predicate;

/**
 * @author: WangPeng
 * @createTime: 2022/11/04 15:52
 * @description:
 * @version: v1.0
 */
//Predicate<T>断言型函数式接口
//泛型: 参数的类型
//返回值: boolean
//根据参数做相应的条件判断，如果满足条件则返回true,不满足则返回false.
public class TestPredicate {
    public static void main(String[] args) {
        //boolean test(T t);
//        Predicate<String> predicate = (t)->{ return t.length()>5; };
        Predicate<String> predicate = (t)->t.length()>5;
        boolean b = predicate.test("hahah");
        System.out.println(b);
        //boolean test(T t, U u);
//        BiPredicate<String,String> biPredicate = (t,u)->{ return t.equals(u); };
        BiPredicate<String,String> biPredicate = (t,u)-> t.equals(u);
        boolean b1 = biPredicate.test("haha", "hehe");
        System.out.println(b1);
    }
}

